package com.thug.entities;

import org.anddev.andengine.entity.scene.Scene;
import org.anddev.andengine.entity.sprite.Sprite;

import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.thug.engine.BaseGameEntity;
import com.thug.engine.Utility;

public class Obstacle extends BaseGameEntity {

	private Sprite mSprite;
	private Body mBody;
	
	public Obstacle(Sprite s, Body b) {
		mEntityType = EntityType.ET_OBSTACLE;
		mSprite = s;
		mBody = b;
	}
	@Override
	public void init() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void attach(Scene scene) {
		scene.attachChild(mSprite);
		
	}

	@Override
	public void detach(Scene scene) {
		scene.detachChild(mSprite);
		
	}

	@Override
	public void update(float elapsedTime) {
		if(isActive()) {
			Utility.updateSprite(mSprite, mBody, true, true);
		}		
	}

	@Override
	public void beginContact(Body bodyA, Body bodyB, Vector2 normal,
			Vector2[] points) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void endContact(Body bodyA, Body bodyB, Vector2 normal,
			Vector2[] points) {
		// TODO Auto-generated method stub
		
	}
	
	@Override
	public void dispose() {
		mSprite.detachSelf();
		mBody.getWorld().destroyBody(mBody);
		mSprite = null;
		mBody = null;
		
	}
	
	
	@Override
	public float getRotation() {
		// TODO Auto-generated method stub
		return 0;
	}
	@Override
	public float getX() {
		// TODO Auto-generated method stub
		return 0;
	}
	@Override
	public float getY() {
		// TODO Auto-generated method stub
		return 0;
	}


}
